package org.csmzxy.class2333;

public class Pet {
    String type;
    int age;
    boolean vac;

    public void setType(String type){
        this.type = type;
    }

    public void setAge(int age){
        this.age=age;
    }

    public void setVac(boolean vac){
        this.vac=vac;
    }

    public void getType(){
        System.out.println("宠物的类型是"+this.type);
    }
    public void getAge(){
        System.out.println("宠物的年龄是"+this.age);
    }
    public void getVac(){
        if (this.vac){
            System.out.println("已接种疫苗");
        }else{
            System.out.println("未接种疫苗");
        }
        System.out.println(vac ?"已接种疫苗":"未接种疫苗");
    }
    public static void main(String[]args){
        //定义第一个动物小狗
        Pet pet =new Pet();
        pet.setType("小狗");
        pet.setAge(5);
        pet.setVac(false);
        pet.getType();
        pet.getAge();
        pet.getVac();

        Pet pet1 =new Pet();
        pet1.setType("小猫");
        pet1.setAge(2);
        pet1.setVac(true);
        pet1.getType();
        pet1.getAge();
        pet1.getVac();
        
    }

}
